<template>
	<view class="man-login">
		<view class="man-title">
			<image src="../../../static/img/logo_hua.png"></image>
		</view>
		<view class="par-iphone">
			<view class="iphone-text">手机号码</view>
			<input type="number" v-model="mobile" placeholder="输入手机号码" style="width: 70%;"/>
		</view>
		<view class="par-iphone">
			<view class="iphone-text">登录密码</view>
			<input type="password" v-model="password" placeholder="输入登录密码（6-20位字母加数字组合)"  style="width: 70%;"/>
		</view>
		<!-- <view @click="hanldIndex()">登录</view> -->
		<button class="par-but" @tap="hanldIndex()">登录</button>
		<!-- <view @click="toForgetPwd()" style="text-align: center;color: #FE4744;font-size: 14px;padding: 10px;">忘记密码?</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mobile:'',
				password:''
			}
		},
		methods: {
			toForgetPwd(){
				uni.navigateTo({
					url:'/pages/member/horseman/reviseLoginPwd'
				})
			},
			hanldIndex(){
				if(!this.mobile){
					uni.showToast({
						title:'请输入手机号码',
						icon:'none'
					})
					return
				}
				if(!this.password){
					uni.showToast({
						title:'请输入登录密码',
						icon:'none'
					})
					return
				}
				if (!(/^(?=.*\d)(?=.*[a-zA-Z]).{6,20}$/.test(this.password))) {
					uni.showToast({
						title:'登录密码为6-20位字母数字组合',
						icon:'none'
					})
					return
				}
				let formData = {
					mobile:this.mobile,
					password:this.password
				}
				uni.showLoading({})
				let that = this
				this.$http.rider_login(formData).then(res => {
					uni.hideLoading()
					console.log(res)
					uni.showToast({
						title:res.msg,
						icon:'none'
					})
					if(res.code == 0){
					  uni.setStorageSync('riderMobile',that.mobile)
					  uni.setStorageSync('riderToken',res.data.token)
					  setTimeout(() => {
						uni.redirectTo({
							url:'/pages/member/horseman/Index'
						})
					  },1000)
					}
				})
				
			}
		}
	}
</script>

<style scoped>
	.man-login{
		width: 100%;
		padding: 15px;
	}
.par-iphone{
	display: flex;
	flex-direction: row;
	background-color: rgba(187, 187, 187, 0.1);
	height: 43px;
	border-radius: 5px;
	align-items: center;
	margin: 10px 0;
}

.iphone-text{
color: #242424;
font-size: 14px;
padding: 0 12px;
min-width: 116upx;
}
.uni-input-placeholder{
	font-size: 12px;
	color: #898989;
}
.man-title{
	text-align: center;
	margin-bottom: 30px;
}
.man-title image{
	width: 96px;
	height: 70px;
}

.par-but{
	width:555upx;
	height:80upx;
	
	background: linear-gradient(124deg, #6AA7E8 0%, #3D9AFD 100%);
	
box-shadow: 0px 2px 4px 0px #1E75FF;
	border-radius:48upx;
	line-height: 80upx;
	text-align: center;
	font-size: 14px;
	color: #FFFFFF;
	margin: 30px auto;
}
</style>
